<!doctype html>
<html>
<head>
    <title>Test Page</title>
</head>
<body class="yui3-skin-sam">
<h1>Console filter plugin tests</h1>
<div id="log"></div>

<script src="../../../build/yui/yui.js"></script>
<script>
YUI({ filter : 'raw' }).use('test','console-filters', function (Y) {

var suite = new Y.Test.Suite("Tests");

suite.add(new Y.Test.Case({
    name : "resources",

    _should: {
        fail: {
            //test_skin_loaded: 2529194 // bug
        }
    },

    test_module_loaded: function () {
        Y.Assert.isFunction(Y.Plugin.ConsoleFilters);
    },

    test_skin_loaded: function () {
        var found = Y.all('link').some(function (node) {
            if (/console-filters.css/.test(node.get('href'))) {
                return true;
            }
        });

        Y.Assert.isTrue(found);
    }
}));

suite.add(new Y.Test.Case({
    name : "instantiation",

    test_instantiation : function () {
        var c = new Y.Console({
            newestOnTop: true,
            boundingBox: '#testbed'
        });
        
        c.plug(Y.Plugin.ConsoleFilters);

        c.destroy();
    },

    test_render : function () {
        var c = new Y.Console({
            newestOnTop: true,
            boundingBox: '#testbed'
        });
        
        c.plug(Y.Plugin.ConsoleFilters);

        c.render();

        c.destroy();
    }
}));

suite.add(new Y.Test.Case({
    name : "ui",

    "Filter controls should be in the footer" : function () {
    }
}));


var yconsole = new Y.Console({ boundingBox:"#log", newestOnTop: false }).
                plug(Y.Plugin.ConsoleFilters).
                render();


//yconsole.hideCategory('info');
yconsole.printLogEntry = function (m) {
    if (m.category === 'section') {
        this._addToConsole(Y.Node.create("<h3>"+m.message+"</h3>"));
        return this;
    } else if (m.category === "break") {
        this._addToConsole(Y.Node.create("<br>"));
        return this;
    } else if (m.category === "info") {
        return this;
    } else {
        return Y.Console.prototype.printLogEntry.call(this,m);
    }
};

Y.log("Tests","section","TestRunner");

Y.Test.Runner.add(suite);

Y.Test.Runner.run();

});
</script>
</body>
</html>
